
package de.justphil.tcg.tcgandroidclient.gui.gameboard;

import de.justphil.tcg.tcgandroidclient.content.CardData;
import de.justphil.tcg.tcgandroidclient.content.TCGContentAdapter;
import android.database.ContentObserver;
import android.os.Handler;
import android.os.Looper;

public class CardUpdater extends ContentObserver {
	
	private final TCGContentAdapter contentAdapter;
	private final Card card;
	private final int cardType;
	
	public CardUpdater(Looper looper, TCGContentAdapter contentFetcher, Card card,
			int cardType) {
		
	
		super(new Handler(looper));
		this.contentAdapter = contentFetcher;
		this.card = card;
		this.cardType = cardType;
	}
	
	@Override
	public void onChange(boolean selfChange) {
	
	
		super.onChange(selfChange);
		CardData cardData = contentAdapter.readCardData(cardType, null);
		card.updateData(cardData);
	}
}
